import request from '@/utils/request'

// 获取版本信息
export function Versions() {
  return request({
    url: '/versions',
    method: 'get'
  })
}
// 获取版本信息
export function Version(exec) {
  return request({
    url: '/version?exec=' + exec,
    method: 'get',
    headers: {
      'hide-error': true
    }
  })
}

// 获取agents
export function Agents(os, app) {
  return request({
    url: '/agents?os=' + os + '&app=' + app,
    method: 'get'
  })
}

// 获取agents
export function Execs() {
  return request({
    url: '/execs',
    method: 'get'
  })
}

// 停止应用
export function AgentStopProcess(agentID) {
  return request({
    url: '/agent/process/stop',
    method: 'post',
    headers: {
      'agent': agentID,
      'hide-error': true
    }
  })
}

// 启动应用
export function AgentStartProcess(agentID) {
  return request({
    url: '/agent/process/start',
    method: 'post',
    headers: {
      'agent': agentID,
      'hide-error': true
    }
  })
}

// 更新应用运行程序
export function AgentProcessExecUpdate(agentID) {
  return request({
    url: '/agent/process/update/exec',
    method: 'post',
    headers: {
      'agent': agentID,
      'hide-error': true,
      'timeout': 10000
    }
  })
}
